class Person {
    private _name: string
    private age: number
    private id: string
    constructor(name: string, age: number, id: string) {
        this._name = name
        this.age = age
        this.id = id
    }

    // set和get可以对象属性的访问操作进行拦截
    set name(value: string) {
        this._name = value
    }
    get name(): string {
        return this._name
    }
}

const p = new Person('马云', 50, '1')
p.name = '陶品奇'
console.log(p.name);
